﻿function _dialog(id, title) {
    this.id = id;
    this.dlg = $(id);
    this.dlg.dialog({ title: title });
    this.dlg.find('.close_dlg').click(function () {
        $(id).dialog('close');
    });

    var obj = this;
    this.dlg.find('.do').click(function () {
        if (obj.beforeDo)
            obj.beforeDo();
    });
}

_dialog.prototype.show = function () {
    if (this.beforeShow)
        if (this.beforeShow() == false)
            return;

    this.dlg.dialog('open');
}

_dialog.prototype.close = function () {
    this.dlg.dialog('close');
}


function formatter_datetime(v, r, i) {
    return new Date(v).toLocaleString()
}

function formatter_date(v, r, i) {
    return new Date(v).toLocaleDateString();
}

function formatter_time(v, r, i) {
    return new Date(v).toLocaleTimeString();
}